package service

import (
	"cooke-home/common/model/base_dto"
	"cooke-home/stock-service/mapper"
	"cooke-home/stock-service/model/dto"
	"cooke-home/stock-service/model/entity"
)

type StockServiceImpl struct {
	stockMapper mapper.StockMapper
}

func NewStockServiceImpl(stockMapper mapper.StockMapper) *StockServiceImpl {
	return &StockServiceImpl{
		stockMapper: stockMapper,
	}
}

func (ss *StockServiceImpl) Save(stockDto *dto.StockDto) error {
	return ss.stockMapper.Save(stockDto)
}

func (ss *StockServiceImpl) Delete(batchDeleteDto base_dto.BatchDeleteDto) error {
	return ss.stockMapper.Delete(batchDeleteDto)
}

func (ss *StockServiceImpl) Update(stockDto *dto.StockDto) error {
	return ss.stockMapper.Update(stockDto)
}

func (ss *StockServiceImpl) Get(id int64) (*entity.StockEntity, error) {
	return ss.stockMapper.Get(id)
}

func (ss *StockServiceImpl) GetList(parentId int64) ([]*entity.StockEntity, error) {
	return ss.stockMapper.GetList(parentId)
}

func (ss *StockServiceImpl) Clear(stockDto *dto.StockDto) error {
	return ss.stockMapper.Clear(stockDto)
}

func (ss *StockServiceImpl) Minus(stockDto *dto.StockDto) error {
	return ss.stockMapper.Minus(stockDto)
}
